﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StoreDetailReport.aspx.cs"
    Inherits="H2.NET.Web.Pages.SMD.StoreDetailReport" %>

<style>
    .flowpage1
    {
        margin-top: 4px;
        margin-left: 4px;
    }
    .report1
    {
        width: 99.8%;
    }
    .report2 {
        /*width: auto;*/
        text-align: center;
    }
    .report2 input
    {
        width: 30px;
        border: 0;
        border-bottom: 1px solid #a9a9a9;
        text-align: center;
    }
    .report2 td {
        width: 7.07%;
    }
</style>
<script type="text/javascript">
    $(function () {
        $(".report2 input").keyup(function () {
            var id = $(this).attr("id");
            var oID;
            var hasE = false;
            var isRew = false;
            var gap;
            var isDdcn;
            var east;
            var south;
            var west;
            var north;
            var not;
            var finish;
            if (id.split("_")[0] == "ddcn") {
                isDdcn = true;
            }
            if (id.indexOf("renew") > -1) {
                isRew = true;
            }
            if (id.indexOf("_not") > -1) {
                if (isDdcn) {
                    if (isRew) {
                        $("#ddcn_All_renew_not").val(parseInt(isnull($("#ddcn_East_renew_not").val())) + parseInt(isnull($("#ddcn_South_renew_not").val()))
                        + parseInt(isnull($("#ddcn_West_renew_not").val())) + parseInt(isnull($("#ddcn_North_renew_not").val())));
                    } else {
                        $("#ddcn_All_new_not").val(parseInt(isnull($("#ddcn_East_new_not").val())) + parseInt(isnull($("#ddcn_South_new_not").val()))
                        + parseInt(isnull($("#ddcn_West_new_not").val())) + parseInt(isnull($("#ddcn_North_new_not").val())));
                    }
                } else {
                    if (isRew) {
                        $("#dcss_All_renew_not").val(parseInt(isnull($("#dcss_East_renew_not").val())) + parseInt(isnull($("#dcss_South_renew_not").val()))
                        + parseInt(isnull($("#dcss_West_renew_not").val())) + parseInt(isnull($("#dcss_North_renew_not").val())));
                    } else {
                        $("#dcss_All_new_not").val(parseInt(isnull($("#dcss_East_new_not").val())) + parseInt(isnull($("#dcss_South_new_not").val()))
                        + parseInt(isnull($("#dcss_West_new_not").val())) + parseInt(isnull($("#dcss_North_new_not").val())));
                    }
                }
            }
            if (id.indexOf("_e") > -1) {
                hasE = true;
                oID = id;
                id = id.substring(0, id.indexOf("_e"));
                gap = id + "_gap";
            } else {
                oID = id + "_e";
                gap = id + "_gap";
            }
            not = oID + "_not";
            finish = oID + "_f";
            $("#" + gap).val(parseInt(isnull($("#" + id).val())) - parseInt(isnull($("#" + oID).val())));
            $("#" + not).val(parseInt(isnull($("#" + oID).val())) - parseInt(isnull($("#" + finish).val())));
            if (isDdcn) {
                if (hasE) {
                    if (isRew) {
                        east = parseInt(isnull($("#ddcn_East_renew_e").val()));
                        south = parseInt(isnull($("#ddcn_South_renew_e").val()));
                        west = parseInt(isnull($("#ddcn_West_renew_e").val()));
                        north = parseInt(isnull($("#ddcn_North_renew_e").val()));

                        $("#ddcn_All_renew_e").val(east + south + west + north);
                    } else {
                        east = parseInt(isnull($("#ddcn_East_new_e").val()));
                        south = parseInt(isnull($("#ddcn_South_new_e").val()));
                        west = parseInt(isnull($("#ddcn_West_new_e").val()));
                        north = parseInt(isnull($("#ddcn_North_new_e").val()));

                        $("#ddcn_All_new_e").val(east + south + west + north);
                    }
                } else {
                    if (isRew) {
                        east = parseInt(isnull($("#ddcn_East_renew").val()));
                        south = parseInt(isnull($("#ddcn_South_renew").val()));
                        west = parseInt(isnull($("#ddcn_West_renew").val()));
                        north = parseInt(isnull($("#ddcn_North_renew").val()));

                        $("#ddcn_All_renew").val(east + south + west + north);
                        
                    } else {
                        east = parseInt(isnull($("#ddcn_East_new").val()));
                        south = parseInt(isnull($("#ddcn_South_new").val()));
                        west = parseInt(isnull($("#ddcn_West_new").val()));
                        north = parseInt(isnull($("#ddcn_North_new").val()));

                        $("#ddcn_All_new").val(east + south + west + north);
                    }
                }
            } else {
                if (hasE) {
                    if (isRew) {
                        east = parseInt(isnull($("#dcss_East_renew_e").val()));
                        south = parseInt(isnull($("#dcss_South_renew_e").val()));
                        west = parseInt(isnull($("#dcss_West_renew_e").val()));
                        north = parseInt(isnull($("#dcss_North_renew_e").val()));

                        $("#dcss_All_renew_e").val(east + south + west + north);
                    } else {
                        east = parseInt(isnull($("#dcss_East_new_e").val()));
                        south = parseInt(isnull($("#dcss_South_new_e").val()));
                        west = parseInt(isnull($("#dcss_West_new_e").val()));
                        north = parseInt(isnull($("#dcss_North_new_e").val()));

                        $("#dcss_All_new_e").val(east + south + west + north);
                    }
                } else {
                    if (isRew) {
                        east = parseInt(isnull($("#dcss_East_renew").val()));
                        south = parseInt(isnull($("#dcss_South_renew").val()));
                        west = parseInt(isnull($("#dcss_West_renew").val()));
                        north = parseInt(isnull($("#dcss_North_renew").val()));

                        $("#dcss_All_renew").val(east + south + west + north);
                    } else {
                        east = parseInt(isnull($("#dcss_East_new").val()));
                        south = parseInt(isnull($("#dcss_South_new").val()));
                        west = parseInt(isnull($("#dcss_West_new").val()));
                        north = parseInt(isnull($("#dcss_North_new").val()));

                        $("#dcss_All_new").val(east + south + west + north);
                    }
                }
            }

            if (isDdcn) {
                if (isRew) {
                    $("#ddcn_All_renew_gap").val(parseInt(isnull($("#ddcn_All_renew").val())) - parseInt(isnull($("#ddcn_All_renew_e").val())));
                    $("#ddcn_All_renew_e_not").val(parseInt(isnull($("#ddcn_All_renew_e").val())) - parseInt(isnull($("#ddcn_All_renew_e_f").val())));
                } else {
                    $("#ddcn_All_new_gap").val(parseInt(isnull($("#ddcn_All_new").val())) - parseInt(isnull($("#ddcn_All_new_e").val())));
                    $("#ddcn_All_new_e_not").val(parseInt(isnull($("#ddcn_All_new_e").val())) - parseInt(isnull($("#ddcn_All_new_e_f").val())));
                }
                
            } else {
                if (isRew) {
                    $("#dcss_All_renew_gap").val(parseInt(isnull($("#dcss_All_renew").val())) - parseInt(isnull($("#dcss_All_renew_e").val())));
                    $("#dcss_All_renew_e_not").val(parseInt(isnull($("#dcss_All_renew_e").val())) - parseInt(isnull($("#dcss_All_renew_e_f").val())));
                } else {
                    $("#dcss_All_new_gap").val(parseInt(isnull($("#dcss_All_new").val())) - parseInt(isnull($("#dcss_All_new_e").val())));
                    $("#dcss_All_new_e_not").val(parseInt(isnull($("#dcss_All_new_e").val())) - parseInt(isnull($("#dcss_All_new_e_f").val())));
                }
            }

            


        });
    });

    function isnull(value) {
        if (value == "") {
            value = 0;
        }
        return value;
    }

    function navTabAjaxDone(json) {
        DWZ.ajaxDone(json);
    }

    function queryDetail2() {
        var year = $("#yearSearch", navTab.getCurrentPanel()).val();
        $("#storeDetailRel").loadUrl("/Pages/SMD/StoreDetailReport.aspx", { year: year }, null);
    }

    function resetSummaryDetial2() {
        var year = $("#yearSearch", navTab.getCurrentPanel()).val();
        $("#storeDetailRel").loadUrl("/Pages/SMD/StoreDetailReport.aspx?action=reset", { year: year }, null);
    }

    function exportSummaryDetail2() {
        var year = $("#yearSearch", navTab.getCurrentPanel()).val();
        $("#year", navTab.getCurrentPanel()).val(year);
        $("#StoreDetailReportForm").submit();
    }
    
    function dialogAjaxDone2(json) {
        dialogAjaxDone(json);
        queryDetail2();
    }

</script>
<div class="flowpage1" id="storeDetailRel">
    <form id="StoreDetailReportForm" action='/Pages/SMD/StoreDetailReport.aspx?action=export' method='post'>
        <input type="hidden" name='year' id="year"/>
    </form>
<form id="formDetail" runat="server" action="/Pages/SMD/StoreDetailReport.aspx?action=save"
method="post" onsubmit="return validateCallback(this,dialogAjaxDone2);">
<table class="formTable report1">
    <tr>
        <td>
            <input type="text" id="yearSearch" runat="server" />
            <input type="button" value="查询" onclick="queryDetail2()"/>
            <% if (HasValue)
               { %>
            <input type="button" value="导出exel" onclick="exportSummaryDetail2()"/>
            <% } %>
        </td>
    </tr>
</table>
<br />
    <div  style ="width:99%;text-align:center;" >
<table style="height:99%" class="formTable report2">
    <tr>
        <td>
        </td>
        <td>
        </td>
        <td>
            新店
        </td>
        <td>
            E-approve
        </td>
        <td>
            E-approve提交审批完
        </td>
        <td>
            E-approve提交未审批完
        </td>
        <td>
            GAP
        </td>
        <td>
            E-approve提交未在清单中
        </td>
        <td>
            翻新
        </td>
        <td>
            E-approve
        </td>
        <td>
            E-approve提交审批完
        </td>
        <td>
            E-approve提交未审批完
        </td>
        <td>
            GAP
        </td>
        <td>
            E-approve提交未在清单中
        </td>
    </tr>
    <tr>
        <td rowspan="5">
            DDCN
        </td>
        <td>
            东部
        </td>
        <td>
            <input id="ddcn_East_new" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_East_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_East_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_East_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_East_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_East_new_not" runat="server" />
        </td>
        <td>
            <input id="ddcn_East_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_East_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_East_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_East_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_East_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_East_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            南部
        </td>
        <td>
            <input id="ddcn_South_new" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_South_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_South_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_South_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_South_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_South_new_not" runat="server" />
        </td>
        <td>
            <input id="ddcn_South_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_South_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_South_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_South_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_South_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_South_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            西部
        </td>
        <td>
            <input id="ddcn_West_new" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_West_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_West_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_West_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_West_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_West_new_not" runat="server" />
        </td>
        <td>
            <input id="ddcn_West_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_West_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_West_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_West_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_West_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_West_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            北部
        </td>
        <td>
            <input id="ddcn_North_new" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_North_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_North_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_North_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_North_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_North_new_not" runat="server" />
        </td>
        <td>
            <input id="ddcn_North_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_North_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="ddcn_North_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_North_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_North_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_North_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            全国
        </td>
        <td>
            <input id="ddcn_All_new" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_new_e" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_All_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_All_new_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_renew" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_renew_e" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_All_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="ddcn_All_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="ddcn_All_renew_not" runat="server" readonly/>
        </td>
    </tr>
    <tr>
        <td rowspan="5">
            DCSS
        </td>
        <td>
            东部
        </td>
        <td>
            <input id="dcss_East_new" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_East_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_East_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_East_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_East_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_East_new_not" runat="server" />
        </td>
        <td>
            <input id="dcss_East_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_East_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_East_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_East_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_East_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_East_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            南部
        </td>
        <td>
            <input id="dcss_South_new" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_South_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_South_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_South_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_South_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_South_new_not" runat="server" />
        </td>
        <td>
            <input id="dcss_South_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_South_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_South_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_South_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_South_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_South_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            西部
        </td>
        <td>
            <input id="dcss_West_new" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_West_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_West_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_West_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_West_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_West_new_not" runat="server" />
        </td>
        <td>
            <input id="dcss_West_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_West_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_West_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_West_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_West_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_West_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            北部
        </td>
        <td>
            <input id="dcss_North_new" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_North_new_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_North_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_North_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_North_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_North_new_not" runat="server" />
        </td>
        <td>
            <input id="dcss_North_renew" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_North_renew_e" type="text" runat="server" />
        </td>
        <td>
            <input id="dcss_North_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_North_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_North_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_North_renew_not" runat="server" />
        </td>
    </tr>
    <tr>
        <td>
            全国
        </td>
        <td>
            <input id="dcss_All_new" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_new_e" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_new_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_All_new_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_new_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_All_new_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_renew" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_renew_e" type="text" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_renew_e_f" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_All_renew_e_not" runat="server" readonly/>
        </td>
        <td>
            <input id="dcss_All_renew_gap" runat="server" readonly />
        </td>
        <td>
            <input id="dcss_All_renew_not" runat="server" readonly/>
        </td>
    </tr>
</table>
        </div>
    <br/>
    <div style="text-align:right;width:99.8%">
    <input type="submit" value="保存" />
    <input type="button" value="重置" onclick="resetSummaryDetial2()"/>
    </div>
</form>
</div>
